import 'package:fish_redux/fish_redux.dart';
import 'action.dart';
import 'state.dart';

Effect<EditViewState> buildEffect() {
  return combineEffects(<Object, Effect<EditViewState>>{
    EditViewAction.action: _onAction,
    Lifecycle.initState: _initState,
  });
}

void _onAction(Action action, Context<EditViewState> ctx) {}

void _initState(Action action, Context<EditViewState> ctx) {
  if (ctx.state.defaultValue.isNotEmpty) {
    ctx.dispatch(EditViewActionCreator.setValue(ctx.state.defaultValue));
  }
}
